<html>
    <head>
        <title>

        </title>
    </head
    <body>
        <input type="button" value="增加" id="button1" onclick="funAdd()">
        <input type="button" value="删除" onclick="funRemove()">
       
        <div id="div01">123</div>
               

    </body>
    <script>
        var div1 =document.getElementById("div01")
function funAdd(){
    var pnode = document.createElement("p");
    pnode.innerHTML = "p element";
    div1.appendChild(pnode);
}
    function funRemove(){
        var ptag = document.getElementsByTagName("p");
        var plength = ptag.length;
        for (var i = plength-1; i>=0;i--){
        div1.removeChild(ptag[i]);
        }
    }
    
    </script>
</html>